{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import vtk\n",
    "from vedo import *\n",
    "\n",
    "# Create a volume with tensors\n",
    "pl = vtk.vtkPointLoad()\n",
    "pl.SetLoadValue(100)\n",
    "pl.SetSampleDimensions(6,6,6)\n",
    "pl.ComputeEffectiveStressOn()\n",
    "pl.SetModelBounds(-10,10,-10,10,-10,10)\n",
    "pl.Update()\n",
    "vol = Volume(pl.GetOutput(), mode=1)\n",
    "\n",
    "# Extract a slice of the volume data at index 3\n",
    "zsl = vol.zSlice(3)\n",
    "\n",
    "# Generate tensor ellipsoids\n",
    "# tens = Tensors(vol, source='ellipsoid', scale=10)\n",
    "tens = Tensors(zsl, source='ellipsoid', scale=20)\n",
    "\n",
    "show(vol, tens, zsl, viewup='z')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
